package libnetdb.dm.assoc.base;
import java.io.IOException;

/**
 * The <code>ARInput</code> defines a general input interface for
 * association-rule mining algorithm. It defines several basic
 * operation of the input, includes moving the cursor to the
 * begining of the data, testing if it has reached the end of the
 * input, and reading the next transaction from the input.
 *
 * @author Cheng-Ru Lin
 * @version 1.0
 */
public interface ARInput {
    
    /**
     * Moves the cursor of this input to the begining so that
     * it can be tested if there exist the next (i.e., the first)
     * transaction and then be read the transaction by function
     * <code>next()</code>.
     *
     * @throws IOException for any under laying exception
     */
    public void beforeFirst() throws IOException;

    /**
     * Returns the next transaction of this input.
     *
     * @return the next transaction of this input
     * @throws IOException for any under laying exception
     */
    public Itemset next() throws IOException;

    /**
     * Test if one can read the next transaction form this input
     *
     * @return true if one can read the next transaction from this
     *   input; false otherwise.
     */
    public boolean hasNext() throws IOException;

	/**
  * DHPMiner will call the open function before all read operations. 
  * You can do nothing, or allocate some resources 
  *( file descriptor, database connection) here.
  * 
  * @throws IOException
  */
	 public void open() throws IOException;
    
	 /**
	  * DHPMiner will call the close function after all read operations.
	  *  You can do nothing, or release some resources 
	  * ( file descriptor, database connection) here. 
	  * 
	  * @throws IOException
	  */
	 public void close() throws IOException;   
}
